function uploadAjax({ url, file }) {
  return new Promise((res, rej) => {
    let xhr = new XMLHttpRequest();
    xhr.open("POST", url, true);
    let formData = new FormData();
    formData.append("file", file[0]);
    xhr.send(formData);
    xhr.onreadystatechange = () => {
      if (xhr.readyState == 4) {
        if (xhr.status == 200) {
          res(JSON.parse(xhr.responseText));
        }
      }
    };
  });
}
